// 引入mockjs
const Mock = require('mockjs');

const Random = Mock.Random;

const path = '/table';
function postDemo(params){
    console.log('请求参数', JSON.parse(params.body));
    let parse = JSON.parse(params.body);
    let articles = [];
    for (let i = 0; i < parse.pageSize; i++) {
        let newArticleObject = {
            date: Random.date('yyyy-MM-dd'),
            name: Random.name(),
            province: Random.province(),
            city: Random.city(),
            address: Random.cparagraph(1, 3),
            zip: Random.zip(),
            select: 3
        };
        articles.push(newArticleObject)
    }
    return {code: '00000', msg: 'success', data: {
        total: 1234, list: articles
        }};
}

module.exports =[
    {
        name: 'table-list',
        path: path + '/list',
        type: 'post',
        result:  (params)=>postDemo(params)
    },
];
